﻿<%@ Page Title="" Language="C#" MasterPageFile="~/TestCase.Master" AutoEventWireup="true" CodeBehind="GetBasedPaginationTests.aspx.cs" Inherits="OpenWaves.Web.Tests.GetBasedPagination" %>
<asp:Content runat="server" ID="Head" ContentPlaceHolderID="head">
    <style type="text/css">
        .PageButton
        {
            border: solid black;
            padding: 5px;
            margin: 5px;
            min-width: 20px;
            text-align: center;
        }
    </style>    
</asp:Content>

<asp:Content runat="server" ID="TestCase" ContentPlaceHolderID="TestCasePlaceHolder">
    
    <ow:OptionalContentPlaceholder runat="server" DataItem="<%#Model.CurrentPage%>">
        <div>
            Showing page <%#Model.CurrentPage.Number %> of <%#Model.TotalPagesCount %>
        </div>
        <div>
            Showing items <%#Model.CurrentPage.FirstItemNumber%>  - <%#Model.CurrentPage.LastItemNumber%> of <%#Model.TotalItemsCount %>
        </div>

        <div>
            <ul>
                <asp:Repeater runat="server" DataSource="<%#Model.CurrentPage.Items%>">
                    <ItemTemplate>
                        <li><%#Container.DataItem%></li>
                    </ItemTemplate>
                </asp:Repeater>
            </ul>
        </div>
    </ow:OptionalContentPlaceholder>

    <ow:Pager runat="server">
        <Template>
            <ow:PageButton runat="server" Page="<%#Model.PreviousPage%>" Text="Previous" />

            <ow:PageRepeater runat="server" DataSource="<%#Model.VisiblePages%>">
                <ItemTemplate>
                    <ow:PageButton runat="server" Page="<%#Container.Item%>" />
                </ItemTemplate>
            </ow:PageRepeater>

            <ow:PageButton runat="server" Page="<%#Model.NextPage%>" Text="Next" />
        </Template>

        <PageButtonTemplate>
            <a href="<%#PaginationController.GetPageUrl(Container.Page)%>" class="PageButton"><%#Container.Text ?? Container.Page.Number.ToString()%></a>
        </PageButtonTemplate>

        <UnavailablePageButtonTemplate>
            <span class="PageButton Disabled">
                <%#Container.Text%>
            </span>
        </UnavailablePageButtonTemplate>

        <SelectedPageButtonTemplate>
            <span class="PageButton Current">
                <%#Container.Page.Number%>
            </span>
        </SelectedPageButtonTemplate>
    </ow:Pager>        
</asp:Content>